import org.neodatis.odb.ODBServer;
import org.softmed.neodatis.persistence.impl.ODBPersistenceProvider;
import org.softmed.neodatis.util.id.GenerateIDConfigurator;
import org.softmed.neodatis.util.id.generator.*;
import org.softmed.neodatis.util.provider.*;
import org.softmed.neodatis.util.trigger.TriggerEnvironment;



String aspectODBFileName = "rest.odb";
String aspectODBName = "rest";

server = ClientServerProviderManager.getDefaultServer();
server.registerODB(aspectODBName, mod.path+"/"+aspectODBFileName);
ClientServerProvider csProvider = new ClientServerProvider(server,
		aspectODBName);

GenerateIDConfigurator generateFieldConfig = new GenerateIDConfigurator(
		csProvider);

TriggerEnvironment tenv = new TriggerEnvironment();
tenv.getInserts().add(generateFieldConfig.getGenerateIDTrigger());
server.registerTriggerEnvironments(aspectODBName, tenv);

provider = new ODBPersistenceProvider(csProvider);
name = "rest-admin-provider";



//id setup
pkManager = provider.getPersistenceManager().getPkManager();
pkManager.registerPrimaryKey(Application.class, "id");
pkManager.registerPrimaryKey(Module.class, "id");
pkManager.registerPrimaryKey(Resource.class, "id");

pkManager.registerPrimaryKey(HttpMethod.class, "id");
pkManager.registerPrimaryKey(MimeTypeHandler.class, "id");
pkManager.registerPrimaryKey(Handler.class, "id");
pkManager.registerPrimaryKey(Parameter.class, "id");

// generator setup
generateFieldConfig.registerGenerator(Application.class, "id",new SequentialGenerator());
generateFieldConfig.registerGenerator(Module.class, "id",new SequentialGenerator());
generateFieldConfig.registerGenerator(Resource.class, "id",	new SequentialGenerator());

generateFieldConfig.registerGenerator(HttpMethod.class, "id",	new SequentialGenerator());
generateFieldConfig.registerGenerator(MimeTypeHandler.class, "id",	new SequentialGenerator());
generateFieldConfig.registerGenerator(Handler.class, "id",	new SequentialGenerator());
generateFieldConfig.registerGenerator(Parameter.class, "id",	new SequentialGenerator());


